package com.coffee.order.api.sku.service;

import com.coffee.core.entity.Page;
import com.coffee.core.entity.PagerInfo;
import com.coffee.core.exception.BusinessException;
import com.coffee.order.api.inquire.result.WeiXinPushResult;
import com.coffee.order.api.sku.query.SkuOrderQuery;
import com.coffee.order.api.sku.req.*;
import com.coffee.order.api.sku.result.*;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;


public interface SkuOrderService {

    Page<SkuOrderResult> getPager(SkuOrderQuery param, PagerInfo pr);

    Integer count(SkuOrderQuery param);

    List<MerchantSpellOrderResult> skuOrderService(Integer skuId, Integer spellOrderPeople);

    List<SkuOrderResult> getList(SkuOrderQuery param, PagerInfo pr);

    List<SkuOrderResult> getList(SkuOrderQuery param);

    List<SkuOrderResult> getList();

    void delete(Integer id);

    Map<Integer, SkuOrderResult> getItemMap(Set<Integer> idSet);

    Map<Integer, SkuOrderResult> getItemMap();

    //直接购买下单接口
    OrderResult addOrderByDirect(SkuOrderAddByDirectReq req) throws BusinessException;


    //购物车下单接口
    OrderResult addOrderByCar(SkuOrderAddReq req) throws BusinessException;

    void payOrderByBalance(OrderResult orderResult) throws BusinessException;

    void payCarOrderByBalance(OrderResult orderResult) throws BusinessException;

    //下线购买下单接口

    OrderResult addOrderByOffline(SkuOrderAddByDirectReq req) throws BusinessException;

    OrderResult addOrderCarByOffline(SkuOrderAddReq req) throws BusinessException;
    //先享后付订单下单
    String addOrderByEnjoy(SkuOrderAddByDirectReq req) throws BusinessException;

    OrderResult addOrderCarByEnjoy(SkuOrderAddReq req) throws BusinessException;

    SkuTotalResult getSkuTotalResult(Integer orderId) throws BusinessException;

    void confirmOrder(Integer orderId, String mobile, String smsCode) throws BusinessException;

    //先享后付下单

    //获取购物车抵扣金额
    CarPriceResult getIntegralPrice(Integer cityId, Integer merchantId, List<Integer> skuShopcarId, String isUseIntegral) throws BusinessException;

    //获取商品抵扣金额
    CarPriceResult getIntegralBySku(Integer cityId, Integer merchantId, Integer skuId, Integer skuSalesInformationId, Integer count, String isSpellOrder, String isUseIntegral) throws BusinessException;

    //继续支付
    OrderResult continuePay(Integer skuOrderId, Integer merchantId, Integer merchantCityId, Integer cityId,String isBalance) throws BusinessException;


    //物流付费
    OrderResult logisticsPay(Integer merchantId, Integer skuOrderDeliveryDemandId) throws BusinessException;

    //上传物流单号
    WeiXinPushResult setDeliveryDemand(SkuOrderDeliveryDemandResult skuOrderDeliveryDemandResult) throws BusinessException;

    //设置运费
    WeiXinPushResult setPostage(SkuOrderDeliveryDemandResult skuOrderDeliveryDemandResult) throws BusinessException;

    //申请退款
    void applyRefund(Integer merchantId, Integer skuOrderDetailId, String applyRefundReason) throws BusinessException;

    void applyRefundNotify(Integer id, Date successTime, String refundId) throws BusinessException;

    void cancelApplyRefund(Integer merchantId, Integer skuOrderDetailId) throws BusinessException;

    //审核退款
    SkuApplyOrderResult examineRefund(Integer supplierId, Integer skuOrderDetailId, String status, String refuseRefundReason, String type) throws BusinessException;

    //审核取消
    void examineWaitingCancel(Integer skuOrderId, String status, String refuseRefundReason) throws BusinessException;

    //直接退款
    SkuApplyOrderResult examineRefundByDirect(Integer supplierId, Integer skuOrderDetailId, String refuseRefundReason, String type, Integer firstSupplierId) throws BusinessException;

    Page<SkuOrderResult> getOrderListResultList(PlatformOrderListReq req, PagerInfo pagerInfo) throws BusinessException;

    List<SkuOrderResultExport> getOrderListResultListExport(PlatformOrderListReq req, PagerInfo pagerInfo) throws BusinessException;

    //商户端查看订单列表
    SkuOrderCountResult getMerchantOrderResult(String status, Integer merchantId, PagerInfo pagerInfo);


    List<SkuOrderResult> getMerchantOrderResultByNoSuccess(Integer merchantId);

    Page<SkuOrderResult> getMerchantOrderResultByPeriodization(Integer merchantId, PagerInfo pagerInfo);

    PeriodizationOrderDetailResult getPeriodizationOrderDetailResult(Integer merchantId, Integer orderId);

    //商户端查看先享后付订单列表
    EnjoySkuOrderResult getEnjoySkuOrderResult(String date, Integer merchantId, PagerInfo pagerInfo, Integer dailiMerchantId);

    void confirmOrder(Integer id, Integer merchantId) throws BusinessException;

    //取消订单
    void cancelOrder(Integer id, Integer merchantId, String applyRefundReason) throws BusinessException;

    SkuOrderResult getSkuOrderResultDetail(Integer skuOrderId, Integer merchantId) throws BusinessException;

    SkuOrderResult getSkuOrderResultDetailBySupplier(Integer skuOrderId, Integer supplierId, String roleType) throws BusinessException;

    //取消等待订单
    void cancelWaitingOrder();

    //交易成功
    void transactionFinash();

    //取消拼团失败订单
    void cancelWatiPartOrder();

    List<Map<String, String>> remindEnjoyOrder(Date date);

    List<Map<String, String>> remindPeriodizationOrder(Date date);

    //是否具有先享后付
    Boolean isEnjoy(SkuOrderAddByDirectReq req) throws BusinessException;

    Boolean isEnjoyByCar(SkuOrderAddReq req) throws BusinessException;

    //分期够定金下单
    OrderResult addPeriodizationDepositOrder(PeriodizationDepositOrderReq req) throws BusinessException;

    //分期够下单
    OrderResult addPeriodizationOrderReq(PeriodizationOrderReq req) throws BusinessException;

    Map<Object, Object> getPeriodizationPrice(PeriodizationOrderReq req) throws BusinessException;

    void finishEnjoyOrder(List<Integer> ids);

    void modifyPrice(Integer skuOrderId, Integer skuOrderDetailId, Double price) throws BusinessException;
}